/**
 * Copyright (c) 2010, QinJian
 * All rights reserved.
 */
package com.q.course.service.classes;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.q.course.dao.classes.ClassesDao;
import com.q.course.entity.classes.Classes;

/**
 * @author 覃健,Email:j411@qq.com
 *
 */
@Component
@Transactional
public class ClassesService {

	@Autowired
	private ClassesDao classesDao;
	
	public Object[] saveClasses( Classes classes ){
		classesDao.save(classes);
		return new Object[]{true , new Object[]{classes.getId(), classes.getPlaceId()}};
	}
	
	@Transactional( readOnly=true )
	public List<Classes> getClasses(){
		return classesDao.findPlaceByClass(true);
	}
	
	@Transactional( readOnly=true )
	public List<Classes> getByPlace(Long pid){
		return classesDao.findByExistStateAndPlaceId(true, pid);
	}
	
	@Transactional( readOnly=true )
	public List<Classes> getClassList(){
		return classesDao.findByExistState(true);
	}
}
